package com.cennavi.bigdata.baotou.listener;

import com.cennavi.bigdata.baotou.scripts.InertMongoKakouFlowMinute;
import com.cennavi.bigdata.baotou.scripts.InsertMongoKakouFlow;
import com.cennavi.bigdata.baotou.scripts.InsertMongoKakouFlowHour;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * Created by cennavi on 2017/12/1.
 */
@Component
public class SpringTask {

    /**
     * 定时向MongoDB中的卡口流量小时表插入数据
     */
    @Scheduled(cron = "0 1 0 1 * ?")
    public void insertMongoKakouFlowHour1(){
        new InsertMongoKakouFlowHour().insertMongoKakouFlowHourWork();
    }

    /**
     * 定时向MongoDB中的分钟表中插入卡口流量数据
     */
    @Scheduled(cron = "0 1 0 1 * ?")
    public void inertMongoKakouFlowMinute1(){
        new InertMongoKakouFlowMinute().insertMongoNWorkMinte();
    }


    /**
     * 定时更新MongoDB中的卡口流量历史表（包括分钟、小时）
     */
    @Scheduled(cron = "0 0 0 2 * ?")
    public void insertMongoKakouFlow1(){
        new InsertMongoKakouFlow().insertKakouFlowByHour();
    }

}
